package org.example.yupao.exception;

import lombok.Data;
import org.example.yupao.common.ErrorCode;

public class BusineseException extends RuntimeException{
    private final int code;
    private final String description;

    public BusineseException(String message,int code, String description) {
        super(message);
        this.code = code;
        this.description = description;
    }

    public BusineseException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = errorCode.getDescription();
    }

    public BusineseException(ErrorCode errorCode,String description) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = description;
    }


    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
